<!DOCTYPE html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script>
test(function() {
  var canvas = document.createElement('canvas');
  canvas.width = canvas.height = 10;
  var offscreen = canvas.transferControlToOffscreen();
  var ctx = offscreen.getContext('2d');
  ctx.fillStyle = '#ff0';
  ctx.fillRect(0, 0, 10, 10);
  var pixel = ctx.getImageData(0, 0, 1, 1).data;
  assert_array_equals(pixel, [255, 255, 0, 255]);
}, "Verify that commit preserves the contents of an OffscreenCanvas with a 2d context.");
</script>
